#!/usr/bin/env python
# coding=utf-8

# File Name: recieve.py
# Author: Bill Zhang
# Mail: zchcandid@gmail.com 
# Created Time: Fri 29 Nov 2013 03:08:41 PM CST
import pika
import time
#from libUpdate import getCode
#from libUpdate import toUpdate
def recieve():
    connection = pika.BlockingConnection(pika.ConnectionParameters( host = 'localhost' ))
    channel = connection.channel()
    channel.queue_declare(queue = 'icmall' , durable = True )
    channel.basic_qos(prefetch_count = 1 )
    channel.basic_consume(callback,queue = 'icmall')
    channel.start_consuming()
def callback(ch, method, properties, body):
    body=body.decode()
    time.sleep( body.count('.')  )
    ch.basic_ack(delivery_tag = method.delivery_tag)
#    HtmlCode=getCode(url)
#    bcd=toUpdate(HtmlCode,"Digikey")    
    print(body)

